package com.mfnote.view.chatemoji;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
/**
 * ViewPager 填充数据，切记做其他操作！！！只填充View！！！！
 * @author ZHF
 *
 */
public class ViewPageAdapter extends PagerAdapter {
	
	private List<View> pageViews;

	public ViewPageAdapter(List<View> pageViews) {
		super();
		this.pageViews = pageViews;
	}

	@Override
	public int getCount() {
		return pageViews.size();
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}
	
	@Override
	public int getItemPosition(Object object) {
		// TODO Auto-generated method stub
		return super.getItemPosition(object);
	}

	
	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		// TODO Auto-generated method stub
		container.removeView(pageViews.get(position));
	}

	/**获取每一个item,类似于listView中的getView**/
	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		container.addView(pageViews.get(position));
		return pageViews.get(position);
	}

	
}
